package com.my.chapter11;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;

public class practice16 {
    static void countWords(String[] str){
        Set<String> set = new TreeSet<String>();
        Collections.addAll(set,"A E I O U a e i o u".split(" "));
        int countAll = 0;
        int countV = 0;
        for(String s:str){
            countV = 0;
            char[] chars = s.toCharArray();
            for(char c:chars){
                String n = c+"";
                if(set.contains(n)){
                    countV++;
                    countAll++;
                }
            }
            System.out.println(s + "："+countV);
        }
        System.out.println("所有元音字母："+countAll);
    }

    public static void main(String[] args) {
        String s = "A contented mind is the greatest blessing a man can enjoy in this world";
        String[] str = s.split(" ");
        countWords(str);
    }
}
